package org.jsbd.boss.dao.impl;

import java.util.HashMap;
import java.util.Map;

import org.jsbd.boss.dao.IHeartbeatDAO;
import org.jsbd.boss.domian.channel.Heartbeat;
import org.jsbd.boss.domian.channel.OS;
import org.springframework.stereotype.Repository;

@Repository("heartbeatDao")
public class HeartbeatDAOImpl extends CrackBaseDao implements IHeartbeatDAO {

	@Override
	public Map<String, Object> selectHeartbeatByPage(Heartbeat heartbeat) {
		heartbeat = (heartbeat == null ? new Heartbeat() : heartbeat);
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("rows", super.queryForList("qy_heartbeat.SELECT_HEARTBEAT_BY_PAGE_LIST", heartbeat));
		map.put("total", super.queryForCount("qy_heartbeat.SELECT_HEARTBEAT_BY_PAGE_COUNT", heartbeat));
		return map;
	}

	@Override
	public void insertHeartbeat(Heartbeat heartbeat) {
		super.insert("qy_heartbeat.INSERT_HEARTBEAT", heartbeat);
	}

	@Override
	public void updateHeartbeat(Heartbeat heartbeat) {
		super.update("qy_heartbeat.UPDATE_HEARTBEAT", heartbeat);
	}

	@Override
	public void phoneTypeEdit(Heartbeat heartbeat) {
		super.update("qy_heartbeat.UPDATE_PHONE_TYPE_EDIT", heartbeat);
	}

	@Override
	public Heartbeat selectByVersion(String version) {
		return (Heartbeat) super.queryForObject("qy_heartbeat.SELECT_BY_VERSION", version);
	}

}
